window.onload = function() {
	document.getElementById('change_pass').onclick = function() {
		var old_pass = document.getElementById('old_pass').value;
		var new_pass = document.getElementById('new_pass').value;
		var con_new_pass = document.getElementById('con_new_pass').value;

		var b_oldpass = ver_pass(old_pass);
		var b_newpass = ver_pass(old_pass);
		var b_two_pass = ver_two_pass(new_pass, con_new_pass);

		if(!b_oldpass) {
			document.getElementById("warn_old_pass").style.display = "inline-block";
		}
		if(!b_newpass) {
			document.getElementById("warn_new_pass").style.display = "inline-block";
		}
		if(!b_two_pass && b_newpass) {
			document.getElementById("warn_con_pass").style.display = "inline-block";
		}

		if(b_oldpass && b_newpass && b_two_pass) {
			document.forms[0].submit();
		}
	}

	var old_pass = document.getElementById("old_pass");
	if(old_pass.addEventListener) {
		old_pass.addEventListener("blur", function() {
				var b_oldpass = ver_pass(this.value);
				if(b_oldpass) {
				document.getElementById("warn_old_pass").style.display = "none";
				} else {
				document.getElementById("warn_old_pass").style.display = "inline-block";
				}
				}, false);
	} else if(old_pass.attachEvent) {
	}

	var new_pass = document.getElementById("new_pass");
	if(new_pass.addEventListener) {
		new_pass.addEventListener("blur", function() {
				var b_newpass = ver_pass(this.value);
				var b_twopass = ver_two_pass(this.value, document.getElementById('con_new_pass').value);
				if(b_newpass && !b_twopass) {
				document.getElementById('warn_new_pass').style.display = "none";
				document.getElementById('warn_con_pass').style.display = "inline-block";
				} else if(b_newpass && b_twopass) {
				document.getElementById('warn_new_pass').style.display = "none";
				document.getElementById('warn_con_pass').style.display = "none";
				} else {
				document.getElementById('warn_new_pass').style.display = "inline-block";
				document.getElementById('warn_con_pass').style.display = "none";
				}
				}, false);
	} else if(new_pass.attachEvent) {
	}

	var con_new_pass = document.getElementById("con_new_pass");
	if(con_new_pass.addEventListener) {
		con_new_pass.addEventListener("blur", function() {
				var b_newpass = ver_pass(document.getElementById('new_pass').value);
				var b_twopass = ver_two_pass(document.getElementById('new_pass').value, this.value);
				if(b_newpass && !b_twopass) {
				document.getElementById('warn_new_pass').style.display = 'none';
				document.getElementById('warn_con_pass').style.display = 'inline-block';
				} else if (b_newpass && b_twopass) {
				document.getElementById('warn_new_pass').style.display = 'none';
				document.getElementById('warn_con_pass').style.display = 'none';
				} else {
				document.getElementById('warn_new_pass').style.display = 'inline-block';
				document.getElementById('warn_con_pass').style.display = 'none';
				}
				}, false);
	} else if(con_new_pass.attachEvent) {
	}
}
